# ====================
# Makefile for AmigaVR
# ====================

include Makefile.config

all: $(PROJECT) $(PROJECT).hex $(PROJECT).eep $(PROJECT).lss size

$(PROJECT): $(OBJS) $(AMIGAVR_INC)
	$(CC) $(LDFLAGS) -o $(BINDIR)/$(TARGET) $(OBJS) $(LIBDIRS) $(LIBS)

%.o: %.c
	$(CC) $(CFLAGS) -c $< -o $@


$(PROJECT).hex: $(PROJECT)
	avr-objcopy -O ihex $(HEX_FLASH_FLAGS) $(BINDIR)/$(TARGET) $(BINDIR)/$@

$(PROJECT).eep: $(PROJECT)
	-avr-objcopy $(HEX_EEPROM_FLAGS) -O ihex $(BINDIR)/$(TARGET) $(BINDIR)/$@ || exit 0

$(PROJECT).lss: $(PROJECT)
	avr-objdump -h -S $(BINDIR)/$(TARGET) > $(BINDIR)/$@

size: $(PROJECT)
	@echo
	@avr-size $(BINDIR)/$(TARGET)

clean:
	rm -f src/*.o src/deps/*.d
	rm -f bin/*
	rm -f *~ src/*~ inc/*~

.PHONY: clean
